﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GoodADD.aspx.cs" Inherits="Admin_shop_UpImgDemo" ValidateRequest="false" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>商品添加</title>

    <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet" />
    <link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet" />
    <link href="../css/animate.css" rel="stylesheet" />
    <link href="../css/style.css?v=4.1.0" rel="stylesheet" />
    <link href="../css/plugins/iCheck/custom.css" rel="stylesheet" />
    <script src="../js/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="../../js/jquery.form.js"></script>

    <link href="../50/imgup.css" rel="stylesheet" />
    <link href="../50/style.css" rel="stylesheet" />
    <script src="../50/function.js"></script>
    <script src="../50/webuploader.min.js"></script>
    <script src="../50/webUpload.js"></script>

    <script type="text/javascript" src="../../kingEditor/kindeditor.js"></script>
    <script charset="utf-8" src="../../kingEditor/lang/zh_CN.js"></script>
    <script src="../../js/swfupload/ligerBuild.min.js" type="text/javascript"></script>
    <script type='text/javascript' src="../../js/swfupload/swfupload.js"></script>
    <script type='text/javascript' src="../../js/swfupload/swfupload.queue.js"></script>
    <script src="../../js/swfupload/newaddswfupload.handlers.js" type="text/javascript"></script>
    <link href="../../js/swfupload/ligerui-dialog.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .imgbox img {
            width: 160px;
            height: 160px;
            border: 1px solid #ccc;
        }
    </style>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('#txtContent', {
                resizeType: 2,
                uploadJson: '../../../api/Tools/upload_json.ashx', // 相对于当前页面的路径
                fileManagerJson: '../../../api/Tools/file_manager_json.ashx',
                allowFileManager: true
            });
        });

        //$(function () {
        //    //InitSWFUpload("../../api/Tools/Hup_ajax.ashx?forid=piclib", "Filedata", "2 MB", "../../js/swfupload/swfupload.swf", 1, 1);
        //    var imgurl = document.getElementById("txtIMG").value;
        //    if (imgurl != "") {
        //        $(".imgbox").empty();
        //        $(".imgbox").append("<img src=\"" + imgurl + "\" />");
        //    }
        //});
    </script>
</head>
<body>
    <form id="form1" runat="server" class="form-horizontal m-t">
        <div class="wrapper animated fadeInRight">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox-content">
                        <div class="panel-body">
                            <div class="form-group">
                                <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品分类：</label>
                                    <div class="col-sm-6">
                                        <asp:DropDownList ID="aClassddl" class="form-control" runat="server">
                                        </asp:DropDownList>
                                    </div>
                                </div>


                                <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品名称：</label>
                                    <div class="col-sm-4">
                                        <asp:TextBox ID="txtName" runat="server" class="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品名称" HintInfo="控制在50个字数内，如“玫瑰花”。"></asp:TextBox>
                                    </div>

                                    <%--<div class="col-sm-4">
                                        <label class="col-sm-4 control-label">会员商品：</label>
                                        <asp:CheckBox ID="CBLog" runat="server" Checked="false" CssClass="checkbox-inline i-checks" />选中后，购买该产品可以成为会员！
                                    </div>--%>

                                    <div class="col-sm-4">
                                        <label class="col-sm-4 control-label">虚拟产品：</label>
                                        <asp:CheckBox ID="CBxn" runat="server" Checked="false" CssClass="checkbox-inline i-checks" />选中后，不需物流！
                                    </div>
                                </div>



                                <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品图片：</label>
                                    <%-- <div class="col-sm-2">
                                        <div class="imgbox" style="height: 160px; width: 160px; border: 1px solid red;">
                                        </div>
                                    </div>--%>
                                    <div class="col-sm-6">
                                        <%-- ←此处请传正方形图片  800px*800px不要大于200k

                                  <asp:TextBox ID="txtIMG" runat="server" class="form-control" Style="display: none;"></asp:TextBox>
                                  <a href="javascript:void(0);" class="files" style="margin-left: 20px;">
                                      <input type="file" id="FileUpload" name="FileUpload" onchange="SingleUpload('txtIMG','FileUpload')" /></a>
                                  <a class="uploading">正在上传，请稍候...</a>--%>
                                        <ul class="upload-ul clearfix">
                                            <li class="upload-pick">
                                                <div class="webuploader-container clearfix" id="goodsUpload" style="background: none;"></div>
                                            </li>
                                        </ul>
                                        <input type="text" id="xsimg" runat="server" value="" style="display: none;" />
                                        <input type="text" id="imgs" runat="server" value="" style="display: none;" />
                                    </div>
                                </div>

                           


                                 <div class="col-sm-12">
                                        <label class="col-sm-2 control-label">零售价(商城价格)：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="GPrice" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="邮费" HintInfo="请填写数字">0</asp:TextBox>
                                    </div>

                                    <label class="col-sm-2 control-label">市场价格(原价)：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="GPriceYJ" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品市场价"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>

                                           <label class="col-sm-2 control-label">重量（g）：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="Gweight" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="重量" HintInfo="请填写数字">0</asp:TextBox>
                                    </div>


                                    <label class="col-sm-2 control-label">邮费：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="SPrice3" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="邮费" HintInfo="请填写数字">0</asp:TextBox>
                                    </div>


                                  
                                </div>
                                 

                    <div class="col-sm-12" style="margin-top: 1em;">

                                    <label class="col-sm-2 control-label">执行董事价格：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="RpriceZXDS" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品市场价"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>

                                    <label class="col-sm-2 control-label">董事价格：</label>
                                    <div class="col-sm-1">

                                        <asp:TextBox ID="RpriceDS" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商城销售价格"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>                          

                                    <label class="col-sm-2 control-label">合伙人价：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="RpriceHHR" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="邮费" HintInfo="请填写数字">0</asp:TextBox>
                                    </div>

                     

                                </div>

                                
                                

       
                                 <div class="col-sm-12" style="margin-top: 1em;">
                                 
                                     <label class="col-sm-2 control-label">总代：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="RpriceZD" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品市场价"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>

                                    <label class="col-sm-2 control-label">一级代理：</label>
                                    <div class="col-sm-1">
                                        <asp:TextBox ID="RpriceYJDL" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品市场价"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>

                                    <label class="col-sm-2 control-label">超级会员：</label>
                                    <div class="col-sm-1">

                                        <asp:TextBox ID="RpriceCJHY" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商城销售价格"
                                            HintInfo="请填写数字"></asp:TextBox>
                                    </div>                          

                                  
                                </div>


                                <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品详细：</label>
                                    <div class="col-sm-10">
                                        <textarea id="txtContent" cols="100" rows="8" style="width: 100%; height: 400px; visibility: hidden;" runat="server"></textarea>

                                    </div>
                                </div>

                                     <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品介绍：</label>
                                    <div class="col-sm-6">
                                        <asp:TextBox ID="txtKeyword" runat="server" CssClass="form-control" aria-required="true" 
                                            MaxLength="300" HintTitle="商品介绍" HintInfo="请填写商品介绍，控制在100字以内。"
                                            TextMode="MultiLine"></asp:TextBox>
                                    </div>
                                </div>




                                <%--<div class="col-sm-12" style="margin-top: 1em;">
                              <label class="col-sm-2 control-label">1级会员分销返点：</label>
                              <div class="col-sm-1">
                                  <asp:TextBox ID="fxPrice" runat="server" CssClass="form-control" required="" aria-required="true"
                                      MaxLength="50" HintTitle="1级会员分销返点"
                                      HintInfo="填写数字几，就代表百分之几。例如：填6，就是返点6%。填0，表示不返点。" ></asp:TextBox>%
                              </div>
                          </div>

                            <div class="col-sm-12" style="margin-top: 1em;">
                              <label class="col-sm-2 control-label">2级会员分销返点：</label>
                              <div class="col-sm-1">
                                  <asp:TextBox ID="fxPrice2" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="填写数字几，就代表百分之几。例如：填6，就是返点6%。填0，表示不返点。" HintInfo="请填写数字" ></asp:TextBox>%
                              </div>
                          </div>

                          
                            <div class="col-sm-12" style="margin-top: 1em;">
                              <label class="col-sm-2 control-label">3级会员分销返点：</label>
                              <div class="col-sm-1">
                                  <asp:TextBox ID="fxPrice3" runat="server" CssClass="form-control" required="" aria-required="true" MaxLength="50" HintTitle="3级会员分销返点" HintInfo="填写数字几，就代表百分之几。例如：填6，就是返点6%.填0，表示不返点。" ></asp:TextBox>%
                              </div>
                          </div>--%>

                                <div class="col-sm-12" style="margin-top: 1em;">
                                    <label class="col-sm-1 control-label">商品库存：</label>
                                    <div class="col-sm-2">
                                        <asp:TextBox ID="GCounts" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="50" HintTitle="商品库存"
                                            HintInfo="商品库存，为整数"></asp:TextBox>
                                    </div>

                                    <label class="col-sm-1 control-label">商品排序：</label>
                                    <div class="col-sm-2">
                                        <asp:TextBox ID="GSort" runat="server" CssClass="form-control" required="" aria-required="true"
                                            MaxLength="500" HintTitle="商品排序"
                                            HintInfo="请填写数字">1</asp:TextBox>
                                    </div>

                                    <label class="col-sm-1 control-label">销售量：</label>
                                    <div class="col-sm-2">
                                        <asp:TextBox ID="GSales" runat="server" CssClass="form-control" required="" aria-required="true" HintTitle="销售量" HintInfo="销售量">0</asp:TextBox>
                                    </div>
                                </div>

                                <%--<div class="col-sm-12" style="margin-top: 1em;">
                              <label class="col-sm-2 control-label">商品区域：</label>
                              <div class="col-sm-1">
                                  <asp:DropDownList ID="DropDownList1" runat="server">
                                      <asp:ListItem Value="0">请选择</asp:ListItem>
                                      <asp:ListItem Value="1">A区</asp:ListItem>
                                      <asp:ListItem Value="2">B区</asp:ListItem>
                                      <asp:ListItem Value="3">C区</asp:ListItem>
                                  </asp:DropDownList>
                              </div>
                          </div>--%>

                                <div class="form-group" style="margin-top: 2em;">
                                    <div class="col-sm-8 col-sm-offset-3" style="margin-top: 2em;">
                                        <asp:Button ID="btnSave" runat="server" Text="确认保存" CssClass="btn btn-primary" OnClientClick="setValue();" OnClick="btnSave_Click" />
                                        &nbsp;
  <input type="button" class="btn btn-primary" id="btnCancel" value="取消" onclick="myclose();" />
                                    </div>
                                </div>

                                <div style="margin-top: 10px; text-align: center;">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!-- 全局js -->

    <script src="../js/bootstrap.min.js?v=3.3.6"></script>
    <link href="../css/plugins/sweetalert/sweetalert.css" rel="stylesheet" />
    <script src="../Js/plugins/sweetalert/sweetalert.min.js"></script>

    <!-- iCheck -->
    <script src="../js/plugins/iCheck/icheck.min.js"></script>
    <script>

        function setValue() {
            var myimg = "|";
            var myimgTxt = "|";
            $(".upload-ul").find('li').each(function () {
                if (typeof ($(this).attr("mya")) != "undefined")
                    myimg += $(this).attr("mya") + "|";

                if (typeof ($(this).attr("title")) != "undefined")
                    myimgTxt += $(this).attr("title") + "|";
            });

            $("#xsimg").val(myimg);
            $("#myimgTxt").val(myimgTxt);
        }

        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green'

            });
        });

        $(function () {
            var myimg = "|";
            //上传图片
            var $tgaUpload = $('#goodsUpload').diyUpload({
                url: '../50/imgup.ashx',
                success: function (data) {

                    myimg += data.id + "|";
                    $("#xsimg").val(myimg);
                  

                },
                error: function (err) { },
                auto: true,
                buttonText: '',
                accept: {
                    title: "Images",
                    extensions: 'gif,jpg,jpeg,bmp,png',
                    mimeTypes: 'image/*'
                },
                thumb: {
                    width: 120,
                    height: 90,
                    quality: 100,
                    allowMagnify: true,
                    crop: true,
                    type: "image/jpeg"
                },
                picList: '<%=imgArr%>'
            });
        });
    </script>

    <script type="text/javascript">



        if (typeof (success) != "undefined") {

            swal({ title: msg, type: "success", html: true, confirmButtonText: "成 功", showConfirmButton: true, timer: 1000 }
                , function (isConfirm) {

                    if (isConfirm) {
                        swal("Deleted!", "Your imaginary file has been deleted.", "success");

                    }
                    else {
                        var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引

                        if (typeof (index) != "undefined") {
                            parent.layer.close(index); //执行关闭

                        }
                        else {
                            parent.openItem(successurl, 1, '资讯管理');

                        }

                    }


                }


            );
        }
        function myclose() {
            var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
            parent.layer.close(index); //执行关闭
        }



    </script>
</body>
</html>
